package chapter03

/**
 * @program lu-scala01
 * @description: 访问权限
 * @author: zhanglu
 * @create: 2022-03-10 10:40:00
 */
object C04_Access {

  def main(args: Array[String]): Unit = {
//    val worker = new Worker()
//    worker.printInfo
    val persion: Persion = new Persion()
    println(s"persion ${persion.sex} ${persion.age}")
    persion.printInfo
  }

}

//定义一个子类
class Worker extends Persion {

  override def printInfo: Unit = {
    println("Worker!")
    println(age)
  }

}

